#-*- coding: utf-8 -*-
import pygame, funcs

class SystemData:
    def __init__(self):
        self.scrwidth = 1024 #must be >=1024 cause of UI gfx
        self.scrheight = 768 #you cant play if its <500
        self.fullscr = 0
sd = SystemData()    

class Economy:
    def __init__(self):
        self.credits = 100000
        self.metal = 100000
        self.energy = 0
        self.energyMax = 0 
        
class Ilosc:
    def __init__(self):
        self.i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] #jest 10 id
        self.u = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] #jest 10 id
           
class Unit(pygame.sprite.Sprite):
    def __init__(self, name, idn, hp, image, pos, canmove):
        pygame.sprite.Sprite.__init__(self)
        self.name = name
        self.idn = idn
        self.image = funcs.load_anim_img(image)
        self.rect = self.image[0].get_rect()
        self.rect.topleft = pos
        self.hp = hp
        self.hpmax = hp
        self.hpbar = list()
        self.next = 0
        self.frame = 0
        self.canmove = canmove #if not, its building
    def update(self, dest, camX, camY):
        dest.blit(self.image[self.frame], (self.rect.x-camX, self.rect.y-camY)) 
        if self.next < pygame.time.get_ticks():
            if self.frame < len(self.image)-1:
                self.frame += 1
            else:
                self.frame = 0

            self.next = pygame.time.get_ticks()+100
            
        
        
